package util.dialog;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.wq.cycling.R;

import util.myview.RoundProgressBar;

/**
 * 更新dialog
 * author：wangqi on 2017/4/26 17:48
 * email：773630555@qq.com
 */

public class DialogForUpdata {

	private Context context;
	private Dialog dialog;
	private RoundProgressBar roundProgressBar;

	public DialogForUpdata(Context context) {
		super();
		this.context = context;
		// TODO Auto-generated constructor stub
	}

	public void show() {
		View view = LayoutInflater.from(context).inflate(R.layout.dialog_for_updata, null);
		roundProgressBar = ((RoundProgressBar) view.findViewById(R.id.roundProgressBar));

		dialog = new AlertDialog.Builder(context).create();
		dialog.setCancelable(false);
		dialog.show();
		dialog.setCanceledOnTouchOutside(false);
		dialog.getWindow().setContentView(view);

	}

	public void setProgress(int progress){
		roundProgressBar.setProgress(progress);
	}

	public void dismiss() {
		dialog.dismiss();
	}

}
